
from PySide.QtGui import *

from shinylist import ShinyList

from customer_view import *
from item_view import *
from transaction_view import *

from core.customer import *
from core.transaction import *
from core.item import *

class MenseiMainWindow(QWidget):
	def init_ui(self):
		# Now for the whole window's UI

		layout = QVBoxLayout()
		tab_widget = QTabWidget() 
		overallInstructionText = QLabel() # instructional text stuff

		# Controllers
		transaction_controller = TransactionController()
		customer_controller = CustomerController()
		item_controller = ItemController()

		# Add tab panes here
		tab_widget.addTab(TransactionView(controller=transaction_controller), 'Transactions')
		tab_widget.addTab(ItemView(controller=item_controller), 'Inventory')
		tab_widget.addTab(CustomerView(controller=customer_controller), 'Customers')

		transaction_controller.get_all()
		customer_controller.get_all()
		item_controller.get_all()

		# Format the text
		overallInstructionText.setText('Hello and welcome to the Mensei Enterprises Inventory and Point-of-Sale Management System.\nPlease choose the tab of the database you would like to view or manipulate.')
		overallInstructionText.wordWrap()

		layout.addWidget(overallInstructionText) # add the text to the layout
		layout.addWidget(tab_widget) # Add the tab widget
		self.setLayout(layout) # Set the layout of the widget window

	def __init__(self, parent=None):
		super(MenseiMainWindow, self).__init__(parent)
		self.setWindowTitle('Mensei Inventory and Point-of-Sale System')
		self.init_ui()

def main():
    import sys
    app = QApplication(sys.argv)

    wnd = MenseiMainWindow()
    wnd.setMinimumSize(640,480)
    wnd.setGeometry(0,0,640,480)
    wnd.show()
    
    sys.exit(app.exec_())

if __name__ == '__main__':
	main()

